package io.renren.modules.bs.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.bs.entity.BsExtractDetailPatientEntity;
import io.renren.modules.bs.vo.ExtractDetailPatientVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-08-15 23:03:14
 */
@Mapper
public interface BsExtractDetailPatientDao extends BaseMapper<BsExtractDetailPatientEntity> {

    @Select("SELECT edp.*,dp.hospitalization_date,dp.leave_hospital_date,pat.patient_name,pat.gender FROM bs_extract_detail_patient edp \n" +
            "LEFT JOIN bs_department_patient dp on edp.department_patient_id = dp.department_patient_id\n" +
            "LEFT JOIN bs_patient pat on pat.patient_id = dp.patient_id\n" +
            "WHERE edp.detail_id = #{detailId}")
    List<ExtractDetailPatientVo> listByDetailId(@Param("detailId") Long detailId);
}
